import 'package:flutter/material.dart';

/// Create： Zhang 3/24/21 5:08 PM
/// 描述：通用组件

///分割线
Container dividerLine({
  double height: 0.3,
  double width: double.infinity,
  double left: 0.0,
  double right: 0.0,
  double top: 0.0,
  double bottom: 0.0,
  color: const Color(0xffCFCFCF),
}) =>
    Container(
      margin: EdgeInsets.only(
        left: left,
        right: right,
        top: top,
        bottom: bottom,
      ),
      height: height,
      width: width,
      color: color,
    );

///CardView控件
Container cardView({
  AlignmentGeometry? alignment,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  Widget? child,
  double? width,
  double? height,
  Color bgColor: const Color(0xffffffff),
  double borderRadius = 4,
  Offset offset = Offset.zero,
  bool isShowShadow = true,
  Color shadowColor = Colors.black38,
}) {
  return Container(
    alignment: alignment,
    padding: padding,
    margin: margin,
    width: width,
    height: height,
    decoration: BoxDecoration(
        color: bgColor,
        borderRadius: BorderRadius.circular(borderRadius),
        boxShadow: isShowShadow
            ? [
                BoxShadow(
                  color: shadowColor,
                  blurRadius: borderRadius,
                  offset: offset,
                )
              ]
            : []),
    child: child,
  );
}
